package com.orhon.smartcampus.modules.base.inputMapper;

import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.modules.base.gqlInputModel.GQLDictionaryInput;
import com.orhon.smartcampus.basicComponents.ConvertHelper;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.Map;

@Mapper(uses = {
        ConvertHelper.class
})
public interface DictionaryInputMapper {


    DictionaryInputMapper MAPPER = Mappers.getMapper(DictionaryInputMapper.class);

    default GQLDictionaryInput mapInput(final Map map){
        String json = JSON.toJSONString(map);
        GQLDictionaryInput input = JSON.parseObject(json , GQLDictionaryInput.class);
        return input;
    }
}
